package cn.stylefeng.guns.tree;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class LayuiTree{

    private String name;
    private String value;
    private boolean selected;
    private boolean disabled;
    private String temp;
    private String parentId;
    private int depth = 0;
    private List<LayuiTree> children = new ArrayList<>();

    public LayuiTree(){}


    public String getTitle() {
        return name;
    }

    public void setTitle(String title) {
        this.name = title;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return value;
    }

    public void setId(String id) {
        this.value = id;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public boolean isDisabled() {
        return disabled;
    }

    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

    public String getTemp() {
        return temp;
    }

    public void setTemp(String temp) {
        this.temp = temp;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public int getDepth() {
        return depth;
    }

    public void setDepth(int depth) {
        this.depth = depth;
    }

    public List<LayuiTree> getChildren() {
        return children;
    }

    public void setChildren(List<LayuiTree> children) {
        this.children = children;
    }

    @Override
    public boolean equals(Object obj) {
        if(this == obj) return true;
        if(obj == null) return false;
        if (obj instanceof LayuiTree) {
            return Objects.equals(((LayuiTree) obj).getName(), this.getName()) && Objects.equals(((LayuiTree) obj).getParentId(), this.getParentId());
        }
        return super.equals(obj);
    }

    @Override
    public int hashCode() {
        return this.value.hashCode() * this.parentId.hashCode();
    }
}
